package com.unknow.first.dapp.admin.account.job;

import com.unknow.first.dapp.admin.account.service.AddressWithdrawService;
import lombok.extern.slf4j.Slf4j;
import org.cloud.scheduler.constants.MisfireEnum;
import org.cloud.scheduler.job.BaseQuartzJobBean;
import org.jetbrains.annotations.NotNull;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.io.IOException;


/**
 * 扫描日志
 */
@Slf4j
public class ProcessWithdrawOrderStatusSuccessJob extends BaseQuartzJobBean {




    private AddressWithdrawService addressWithdrawService;

    public ProcessWithdrawOrderStatusSuccessJob(AddressWithdrawService addressWithdrawService) {
        this.addressWithdrawService = addressWithdrawService;
    }


    @Override
    protected void init() {
        this.jobName = "处理遗漏的已完成提现订单状态";
        jobData.put("description", "处理遗漏的已完成提现订单状态");
        this.jobTime = "0 0/1 * * * ? ";
        setMisfire(MisfireEnum.CronScheduleMisfireEnum.MISFIRE_INSTRUCTION_DO_NOTHING);
    }

    @Override
    protected void executeInternal(@NotNull JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            addressWithdrawService.processWithdrawStatusDoneBack();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}